feat(jsonrpc): add blockTimestamp to logs and receipts#6671
feat(jsonrpc): add blockTimestamp to logs and receipts#66710xbigapple wants to merge 4 commits intotronprotocol:developfrom
Conversation
92d7b71 to
b3c6ccb
Compare
|
[SHOULD] The implementation looks good and I’m comfortable approving it. One follow-up I’d still recommend is adding direct API-level coverage for |
Thanks for the follow-up. Since |
@0xbigapple Thanks, that makes sense to me overall. I agree this does not need to block the current PR. For I’m fine treating that as follow-up rather than scope for this change. If you file a tracking issue for broader JSON-RPC API-level coverage, please link it here so we have a concrete follow-up item. |
Thanks for the clarification on Agreed this is better tackled as a dedicated effort rather than squeezed into this PR. I don't have the bandwidth to open the tracking issue right away, but I'll circle back and file it when I do, and link it here. |
Sounds good. Agree this can be handled as follow-up and does not need to block this PR. Please link the tracking issue here once it is filed. |
What does this PR do?
Adds the
blockTimestampfield to the log objects returned by JSON-RPC event and receipt query interfaces, aligning the TRON JSON-RPC implementation with the Ethereum execution-apis specification. close #6617Specifically, it updates:
LogFilterElement(used ineth_getLogs,eth_getFilterLogs,eth_getFilterChanges(about log/event filter)) to includeblockTimestamp.TransactionLogwithinTransactionReceipt(used ineth_getTransactionReceipt,eth_getBlockReceipts) to includeblockTimestamp.The timestamp is extracted from the corresponding
TransactionInfo'sblockTimeStamp, divided by 1000 to convert to seconds, and returned as a hexadecimal string (e.g.,"0x3e8").Why are these changes required?
To maintain compatibility with the evolving Ethereum JSON-RPC API standards. Adding the block generation timestamp directly to the log objects enables developers and dApps to process event streams with precise time context without needing to perform secondary
eth_getBlockByHash/Numberqueries, significantly reducing network overhead and improving client efficiency.This PR has been tested by:
LogMatchExactlyTest.javato verifyblockTimestampinLogFilterElement.TransactionReceiptTest.javato verifyblockTimestampinTransactionReceipt.TransactionLog.Follow up
Extra details